<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
</head>
<body>

</body>
<script>
    // 冒泡排序法
    var arr=[2,15,8,82,-33,102,9,74,0,42];
    console.log(arr);
    for(i=0;i<arr.length-1;i++){
        for(j=0;j<arr.length-i;j++){
            var s=0;
            if(arr[j]>arr[j+1]){
                s=arr[j];
                arr[j]=arr[j+1];
                arr[j+1]=s;
            }
        }
    }
    console.log(arr)

</script>
</html>